<?php
namespace Back\Model;
use Think\Model;

class RoleModel extends Model{

    //角色权限表的字符处理
    public function dispose_role($auth_id) {
        $auth_id = I("post.auth_id");
        $m = M("auth");
        $role_auth_ids = implode(",",I("post.auth_id"));
        $temp = "";
        foreach ($auth_id as $value){
            $info = $m -> where("auth_id = {$value}") -> find();
            if(!empty($info["auth_c"]) && !empty($info["auth_a"])){
                $temp .= $info["auth_c"]."-".$info["auth_a"].",";
            }
        }
        $temp = rtrim($temp,",");
        $role_auth_ac = $temp;
        return array(
            "role_auth_ids" => $role_auth_ids,
            "role_auth_ac" => $role_auth_ac,
        );
    }

}